﻿using SD.Infrastructure.Repository.EntityFrameworkCore;
using SlamDunk.MES.Domain.Entities.PlanContxt;
using SlamDunk.MES.Domain.IRepositories.Interfaces.PlanContxt;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SlamDunk.MES.Repository.Implements.PlanContxt
{
    /// <summary>
    /// 生产物料需求仓储实现
    /// </summary>
    public class ProductionMaterialAskRepository : EFEntityRepositoryProvider<ProductionMaterialAsk>, IProductionMaterialAskRepository
    {
        #region # 获取生产物料需求列表 —— ICollection<ProductionMaterialAsk> Find(Guid productionPlanId)
        /// <summary>
        /// 获取生产物料需求列表
        /// </summary>
        /// <param name="productionPlanId">生产计划Id</param>
        /// <returns>生产物料需求列表</returns>
        public ICollection<ProductionMaterialAsk> Find(Guid productionPlanId)
        {
            IQueryable<ProductionMaterialAsk> materialAsks = base.Find(x => x.ProductionPlan.Id == productionPlanId);

            return materialAsks.ToList();
        }
        #endregion
    }
}
